package com.uzai.console.web.md;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.dto.md.mdactivity.MdActivityCopyDto;
import com.uzai.console.dto.md.mdactivity.MdActivityDto;
import com.uzai.console.dto.md.mdactivity.MdActivityIdDto;
import com.uzai.console.dto.md.mdactivity.MdActivityQuery;
import com.uzai.console.dto.md.mdgoods.MdGoodsQuery;
import com.uzai.console.dto.md.mdgoods.MdGoodsTurnlinkDto;
import com.uzai.console.service.md.mdactivity.MdActivityService;
import com.uzai.console.service.md.mdgoods.ExemptionGoodsService;
import com.uzai.console.vo.md.exemptiongoods.ExemptionGoodsVo;
import com.uzai.console.vo.md.mdactivity.MdActivityCopyUrlVo;
import com.uzai.console.vo.md.mdactivity.MdActivityVo;
import com.uzai.console.vo.md.mdgoods.MdGoodsTurnlinkVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuqi
 * @date 2021年08月25日 20:15
 */
@Api(value = "免单官方活动",tags = "免单管理|免单官方活动")
@ApiSort(60)
@RestController
public class ExemptionGoodsContoller extends BaseController {
    private Logger logger = LoggerFactory.getLogger(ExemptionGoodsContoller.class);

    @Autowired
    private ExemptionGoodsService exemptionGoodsService;

    @ApiOperation(value = "分页查询官方免单活动商品列表", notes = "分页查询官方免单活动商品列表", response = ExemptionGoodsVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/exemptionGoods/findPage")
    public Object findPageByExemptionGoods(@RequestBody MdGoodsQuery mdGoodsQuery){
        return exemptionGoodsService.findExemptionGoodsList(mdGoodsQuery);
    }

    @ApiOperation(value = "查询默认官方免单活动详情", notes = "查询默认官方免单活动详情", response = ExemptionGoodsVo.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/exemptionGoods/findMdExemptionActivity")
    public Object findMdActivity(@RequestBody MdActivityQuery mdActivityQuery){
        return exemptionGoodsService.findMdActivityByDefault(mdActivityQuery);
    }

    @ApiOperation(value = "添加官方免单活动", notes = "添加官方免单活动", response = Boolean.class)
    @ApiOperationSupport(order = 3)
    @PostMapping("/exemptionGoods/addMdActivity")
    public Object addMdExemptionActivity(@RequestBody MdActivityDto mdActivityDto){
        exemptionGoodsService.addMdActivity(mdActivityDto);
        return true;
    }

    @ApiOperation(value = "修改官方免单活动", notes = "修改官方免单活动", response = Boolean.class)
    @ApiOperationSupport(order = 4)
    @PostMapping("/exemptionGoods/updateMdActivity")
    public Object updateMdActivity(@RequestBody MdActivityDto mdActivityDto){
        exemptionGoodsService.updateMdActivity(mdActivityDto);
        return true;
    }

    @ApiOperation(value = "删除官方免单活动", notes = "删除官方免单活动", response = Boolean.class)
    @ApiOperationSupport(order = 5)
    @PostMapping("/exemptionGoods/deleteMdActivity")
    public Object deleteMdActivity(@RequestBody MdActivityIdDto mdActivityIdDto){
        exemptionGoodsService.deleteMdActivity(mdActivityIdDto);
        return true;
    }

    @ApiOperation(value = "暂停官方免单活动", notes = "暂停官方免单活动", response = Boolean.class)
    @ApiOperationSupport(order = 6)
    @PostMapping("/exemptionGoods/pauseMdActivity")
    public Object pauseMdActivity(@RequestBody MdActivityIdDto mdActivityIdDto){
        exemptionGoodsService.pauseMdActivity(mdActivityIdDto);
        return true;
    }

    @ApiOperation(value = "开启官方免单活动", notes = "开启官方免单活动", response = Boolean.class)
    @ApiOperationSupport(order = 7)
    @PostMapping("/exemptionGoods/startMdActivity")
    public Object startMdActivity(@RequestBody MdActivityIdDto mdActivityIdDto){
        exemptionGoodsService.startMdActivity(mdActivityIdDto);
        return true;
    }

}
